﻿<CodeSnippetTabbed DocLink="https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxPivotGrid-1#templates">
    <CodeSnippetTabPage Text="Razor">@(@"<DxPivotGrid Data=""@GridData""
             ShowGrandTotals=""@ShowGrandTotals""
             ShowFieldHeaders=""@ShowFieldHeaders""
             CssClass=""mw-1100"">
    <DxPivotGridField Field=""@nameof(SaleInfo.Region)"" SortOrder=""PivotGridSortOrder.Ascending"" Area=""PivotGridFieldArea.Row"" />
    <DxPivotGridField Field=""@nameof(SaleInfo.Country)"" Area=""PivotGridFieldArea.Row"" />
    <DxPivotGridField Field=""@nameof(SaleInfo.City)"" Area=""PivotGridFieldArea.Row"" />
    <DxPivotGridField Field=""@nameof(SaleInfo.Date)"" GroupInterval=""PivotGridGroupInterval.Year"" Area=""PivotGridFieldArea.Column"" Caption=""Year"" />
    <DxPivotGridField Field=""@nameof(SaleInfo.Date)"" GroupInterval=""PivotGridGroupInterval.Quarter"" Area=""PivotGridFieldArea.Column"" Caption=""Quarter"">
        <HeaderTemplate>
            @($""Q{context}"")
        </HeaderTemplate>
    </DxPivotGridField>
    <DxPivotGridField Field=""@nameof(SaleInfo.Date)"" GroupInterval=""PivotGridGroupInterval.Month"" Area=""PivotGridFieldArea.Column"" Caption=""Month"">
        <HeaderTemplate>
            @System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName((int)context)
        </HeaderTemplate>
    </DxPivotGridField>
    <DxPivotGridField Field=""@nameof(SaleInfo.Amount)"" Area=""PivotGridFieldArea.Data"" SummaryType=""PivotGridSummaryType.Sum"">
        <DataTemplate>
            <span class=""@((decimal)context > 100000 ? ""text-success"" : ""text-danger"")"">
                @string.Format(""{0:c0}"", context)
            </span>
        </DataTemplate>
    </DxPivotGridField>
    <DxPivotGridField Field=""@nameof(SaleInfo.OrderId)"" Caption=""Count"" Area=""PivotGridFieldArea.Data"" SummaryType=""PivotGridSummaryType.Count"">
        <DataTemplate>
            <span class=""font-weight-bold"">@context</span>
        </DataTemplate>
    </DxPivotGridField>
</DxPivotGrid>")</CodeSnippetTabPage>
</CodeSnippetTabbed>
